'  ====================================================================
'  |                                                                  |
'  | SQLitening Special Include                                       |
'  |                                                                  |
'  ====================================================================
'   This include file is intended to be used by non PowerBASIC 
'   programs that use the SQLiteningS.Dll This include file will 
'   need to be modified to support specific language syntax. 
'   Comments include here with some of the Declares are only present 
'   for parameter passing explanation. See SQLitening.Txt or 
'   SQLitening.Chm for information on each command.  Note that some of
'   the declares go directly to SQLitening.Dll rather than SQLiteningS.Dll.
' 
'  ====================================================================
'  PUBLIC DOMAIN SOFTWARE
'  The author or authors of this code dedicate any and all 
'  copyright interest in this code to the public domain. 
'  Anyone is free to copy, modify, publish, use, compile, 
'  sell, or distribute the original code, either in source 
'  code form or as a compiled binary, for any purpose, 
'  commercial or non-commercial, and by any means.
'  Fred Meier - July 2010
' 
'  ====================================================================

'============================<[ Equates ]>=============================
' ==========>>> SQLitening return codes
%SQLitening_NoOpenDatabase          =  -7
%SQLitening_AccessDenied            =  -8
%SQLitening_FileDoesNotExist        =  -9
%SQLitening_FileOpenGetPutError     = -10
%SQLitening_LockTimeout             = -11
%SQLitening_NochangedRows           = -12
%SQLitening_InvalidColumnNameNumber = -13
%SQLitening_InvalidSetNumber        = -14   
%SQLitening_AttachIsInvalid         = -15
%SQLitening_CanNotConnect           = -16
%SQLitening_InvalidKeyOrNotFound    = -17
%SQLitening_SendOrReceiveError      = -18
%SQLitening_InvalidStringOrRequest  = -19
%SQLitening_ErrorAtServer           = -20

' ==========>>> SQLite return codes
%SQLite_OK        = 0         'Successful result
%SQLite_Busy      = 5         'Database is locked
%SQLite_Dups      = 19        'Constraint violation.  Normally caused by 
                              'trying to add a non unique key to an index 
                              'during an Insert or Update.

'============================<[ Declares ]>============================
'   Calls SQLiteningS.Dll which calls SQLitening.DLL.
Declare Function slsAttach lib "SQLiteningS.Dll" alias "slsAttach" (byref rsFileName as String, byref rsAsDatabaseName as String, optional byref rsModChars as String) as Long
Declare Function slsBuildBindDat lib "SQLiteningS.Dll" alias "slsBuildBindDat" (byref rsData as String, optional byref rsModChars as String) as String
Declare Function slsBuildInsertOrUpdate lib "SQLiteningS.Dll" alias "slsBuildInsertOrUpdate" (byref rsTable as String, byref rsValues as String, optional byref rsColumns as String, optional byref rsWhere as String) as String
Declare Function slsConnect lib "SQLiteningS.Dll" alias "slsConnect" (optional byref rsServer as String, optional byval rlPort as Long, optional byref rsModChars as String, optional byref wsDataOut as String)as Long
Declare Function slsConvertDat lib "SQLiteningS.Dll" alias "slsConvertDat" (rsData as String, optional byref rsModChars as String) as String
Declare Function slsCopyDatabase lib "SQLiteningS.Dll" alias "slsCopyDatabase" (rsDestinationFileName as String, optional rsModChars as String, optional rsDatabaseName as String) as Long
Declare Function slsExe lib "SQLiteningS.Dll" alias "slsExe" (byref rsStatement as String, optional byref rsModChars as String) as Long
Declare Function slsExeBind lib "SQLiteningS.Dll" alias "slsExeBind" (byref rsStatement as String, byref rsData as String, optional byref rsModChars as String) as Long
Declare Function slsFNX lib "SQLiteningS.Dll" alias "slsFNX" (byref rsColumnName as String, optional byref rsModChars as String, optional byval rlSetNumber as Long) as String
Declare Function slsFX lib "SQLiteningS.Dll" alias "slsFX" (byval rlColumnNumber as Long, optional byref rsModChars as String, optional byval rlSetNumber as Long) as String
Declare Function slsGetChangeCount lib "SQLiteningS.Dll" alias "slsGetChangeCount" (optional byref rsModChars as String) as Long
Declare Function slsGetFile lib "SQLiteningS.Dll" alias "slsGetFile" (byref rsFileName as String, byref wsFileData as String, optional byref rsModChars as String) as Long
Declare Function slsGetHandle lib "SQLiteningS.Dll" alias "slsGetHandle" (optional byref rsModChars as String, optional byval rlSetNumber as Long) as Long
Declare Function slsGetInsertID lib "SQLiteningS.Dll" alias "slsGetInsertID" () as Currency
Declare Function slsGetRow lib "SQLiteningS.Dll" alias "slsGetRow" (optional byval rlSetNumber as Long, optional byref rsModChars as String) as Long
Declare Function slsGetTableNames lib "SQLiteningS.Dll" alias "slsGetTableNames" (optional byref rsDataBase as String) as String
Declare Function slsOpen lib "SQLiteningS.Dll" alias "slsOpen" (optional byref rsFileName as String, optional byref rsModChars as String) as Long
Declare Function slsPutFile lib "SQLiteningS.Dll" alias "slsPutFile" (byref rsFileName as String, byref rsFileData as String, optional byref rsModChars as String) as Long
Declare Function slsRunProc lib "SQLiteningS.Dll" alias "slsRunProc" (rsProcName as String, blParm1 as Long, blParm2 as Long, bsParm3 as String, bsParm4 as String, optional byref rsModChars as String) as Long
Declare Function slsSel lib "SQLiteningS.Dll" alias "slsSel" (byref rsStatement as String, optional byval rlSetNumber as Long, optional byref rsModChars as String) as Long
Declare Function slsSelStr lib "SQLiteningS.Dll" alias "slsSelStr" (byref rsStatement as String, optional byref rsModChars as String) as String
Declare Function slsSetRelNamedLocks lib "SQLiteningS.Dll" alias "slsSetRelNamedLocks"(byref rsLockNames as String, optional byref rsModChars as String, _
                                                                                      optional byref rsSelStatement as String, optional byval rsSelSetNumber as Long, optional byref rlSelModChars as String) as Long

'   Calls SQLitening.Dll directly.
Declare Sub      slsClose lib "SQLitening.Dll" alias "slClose"
Declare Sub      slsCloseSet lib "SQLitening.Dll" alias "slCloseSet" (optional byval rlSetNumber as Long)
Declare Sub      slsDisconnect lib "SQLitening.Dll" alias "slDisconnect"
Declare Function slsF lib "SQLitening.Dll" alias "slF" (byval rlColumnNumber as Long, optional byval rlSetNumber as Long) as String
Declare Function slsFN lib "SQLitening.Dll" alias "slFN" (byref rsColumnName as String, optional byval rlSetNumber as Long) as String
Declare Function slsGetColumnCount lib "SQLitening.Dll" alias "slGetColumnCount" (optional byval rlSetNumber as Long) as Long
Declare Function slsGetColumnName lib "SQLitening.Dll" alias "slGetColumnName" (optional byval rlColumnNumber as Long, optional byval rlSetNumber as Long) as String
Declare Function slsGetColumnNumber lib "SQLitening.Dll" alias "slGetColumnNumber" (byref rsColumnName as String, optional byval rlSetNumber as Long) as Long
Declare Function slsGetError lib "SQLitening.Dll" alias "slGetError" () as String
Declare Function slsGetErrorNumber lib "SQLitening.Dll" alias "slGetErrorNumber" () as Long
Declare Function slsGetStatus lib "SQLitening.Dll" alias "slGetStatus" (byval rlRequest as Long) as String
Declare Function slsGetTableColumnNames lib "SQLitening.Dll" alias "slGetTableColumnNames" (byref rsTable as String) as String
Declare Function slsGetUnusedSetNumber lib "SQLitening.Dll" alias "slGetUnusedSetNumber" as Long
Declare Function slsIsColumnNameValid lib "SQLitening.Dll" alias "slIsColumnNameValid" (byref rsColumnName as String, optional byval rlSetNumber as Long) as Long
Declare Function slsIsColumnNumberValid lib "SQLitening.Dll" alias "slIsColumnNumberValid" (byval rlColumnNumber as Long, optional byval rlSetNumber as Long) as Long
Declare Function slsIsOpen lib "SQLitening.Dll" alias "slIsOpen" () as Long
Declare Function slsIsFieldNull lib "SQLitening.Dll" alias "slIsFieldNull" (byval rlColumnNumber as Long, optional byval rlSetNumber as Long) as Long
Declare Function slsIsSetNumberValid lib "SQLitening.Dll" alias "slIsSetNumberValid"(optional byval rlSetNumber as Long) as Long
Declare Sub      slsPopDatabase lib "SQLitening.Dll" alias "slPopDatabase" (optional rsSave as String)
Declare Sub      slsPopSet lib "SQLitening.Dll" alias "slPopSet" (optional byval rlSetNumber as Long, optional rsSave as String)
Declare Sub      slsPushDatabase lib "SQLitening.Dll" alias "slPushDatabase" (optional wsSave as String)
Declare Sub      slsPushSet lib "SQLitening.Dll" alias "slPushSet" (optional byval rlSetNumber as Long, optional wsSave as String)
Declare Sub      slsSetProcessMods lib "SQLitening.Dll" alias "slSetProcessMods" (byref rsModChars as String)

